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