UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Sd/s8QCvOEH5ORK3pH42rGdZbMqBO0Essu+sq1hbH38='
WHERE
key_id = 'ed24dcc035c1ac8f200b74483f7d72a8412847eb9681f8711f98686f03d56786'
AND (
token = 'Sd/s8QCvOEH5ORK3pH42rGdZbMqBO0Essu+sq1hbH38='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)