UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SlUH+IylVPhV2gonsP1rN9QRnmRAJM76aoKrz983mB8='
WHERE
key_id = 'b0b0eb4a243831a8d62823f417d1e7dc16ec3a23747816b4fd07bd65275cf29a'
AND (
token = 'SlUH+IylVPhV2gonsP1rN9QRnmRAJM76aoKrz983mB8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)