UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OFNrqgoT44VGWAJKzhUW+iXkx1jrz9D5jGzSggRo7KU='
WHERE
key_id = 'd1d2117102e7e5fb9dc9fdf3a92c5400a35ec164f948ee1388a172f0dba96198'
AND (
token = 'OFNrqgoT44VGWAJKzhUW+iXkx1jrz9D5jGzSggRo7KU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)