UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r/yxj6YQAMhYa4nSsJTV46smKg4kw7ZtWqWWOD8D8DU='
WHERE
key_id = '502f1d371fc173c03227ba57062beb2576d42214f38421dd42f59bdd4a2362a2'
AND (
token = 'r/yxj6YQAMhYa4nSsJTV46smKg4kw7ZtWqWWOD8D8DU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)