UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hf6ANap7Sx5OsmQbRmeqvmW3fjQVyeSfQ2ejM9J2N4Q='
WHERE
key_id = 'fcd2b59c444b503934dcd1d9f42af9c8efb89d7d1d016099440b111ce73251ea'
AND (
token = 'Hf6ANap7Sx5OsmQbRmeqvmW3fjQVyeSfQ2ejM9J2N4Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)