UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FKtJPVNqlAQoFawtXBpiBtK3a3H25tWLaMaw69eX7as='
WHERE
key_id = 'ba9ae5b7ee1ab8916efe4ef4e81521228504ad8f38c43288f06b5ff624c0aeba'
AND (
token = 'FKtJPVNqlAQoFawtXBpiBtK3a3H25tWLaMaw69eX7as='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)