UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KGL8rNOGYbOkTiLpwwau8BorSdaKqE/kDujAvW0bDVY='
WHERE
key_id = '65f71a515672489024f4f56b3a8fc6f52dcc98fcffbf7af83015055b8c6b56e9'
AND (
token = 'KGL8rNOGYbOkTiLpwwau8BorSdaKqE/kDujAvW0bDVY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)