UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AVaj5WXpx8oE9h2OU+mOjrBMZO732FBDlN8dPAIgHFQ='
WHERE
key_id = '3ae1349b69b20ecf80e02ce8f91e98dd57e9bd4908378dbb9f0d24d625840ff2'
AND (
token = 'AVaj5WXpx8oE9h2OU+mOjrBMZO732FBDlN8dPAIgHFQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)