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