UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jasVeKJtZn2S9I4dqtjzPU6J7A+v17BryIOVRykAXEQ='
WHERE
key_id = 'ca167b6f404ed7b222d12ec32114e58123e2a628defb7e122b3c1f5c9b6c0e0b'
AND (
token = 'jasVeKJtZn2S9I4dqtjzPU6J7A+v17BryIOVRykAXEQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)