UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '65IuPQ3a4/89bUnAMA5wBJRepUK61MmHkEds6V+TX9k='
WHERE
key_id = 'fdaad142cc280f2ccb54a99e1d3ba7547825eef758b924beeffaf840bfe77e4a'
AND (
token = '65IuPQ3a4/89bUnAMA5wBJRepUK61MmHkEds6V+TX9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)