UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JiD9NhB/JU6oYzwPjZzw7W+CwLeMYAieA5qsAfner1Q='
WHERE
key_id = '2841c38bae185dba866b0d785a2e3e47ab315acb513c112e12012eb6fb6c53c1'
AND (
token = 'JiD9NhB/JU6oYzwPjZzw7W+CwLeMYAieA5qsAfner1Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)