UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v0HVHXe2jzXClB0ncyshGdSXOwjMmOHq4veHCVutxIM='
WHERE
key_id = '87a30cf1ba57a08bd4d8cbe58531405755b9b6d1d16138b691b15fbb376ef69d'
AND (
token = 'v0HVHXe2jzXClB0ncyshGdSXOwjMmOHq4veHCVutxIM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)