UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fYGDYp03tf/wfE4bQQsnxxWCSQ0bH6RmxyV8oRitU84='
WHERE
key_id = 'bea705b2e219eb2bc7acc6ee57db884997a4759a3749e5df344f378015dc80aa'
AND (
token = 'fYGDYp03tf/wfE4bQQsnxxWCSQ0bH6RmxyV8oRitU84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)