UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tctxqwPCf5XJl5DHN/tbDUQGhzmoQ1qWFqCh7S0ikS0='
WHERE
key_id = '7f96d30ed3836698176b2fe6eb1be187002fcddd776c948988e8e5a810312c5b'
AND (
token = 'tctxqwPCf5XJl5DHN/tbDUQGhzmoQ1qWFqCh7S0ikS0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)