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