UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sNJy+zsa/Dcobc14epTZ9KKhindV2tSxSA1yfiJOBI8='
WHERE
key_id = '3fc5d20912f936df9f182f17abe991af717b3b4d56cf2976c7d0fbcafb4cda2e'
AND (
token = 'sNJy+zsa/Dcobc14epTZ9KKhindV2tSxSA1yfiJOBI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)