UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gOnQDKl/LW5rG8RWgRd8iexGrYl1Jwap+NeumeP3T2k='
WHERE
key_id = 'd7471b901e45be482244a02015691e7a3679451fd51a2befe55a24d6dd805747'
AND (
token = 'gOnQDKl/LW5rG8RWgRd8iexGrYl1Jwap+NeumeP3T2k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)