UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jaY6LwV4mfsmroTdXjHqfKL1S2zw4+NUmsD3Yam/mgo='
WHERE
key_id = 'c4259fe7de7e6f88b094bdbcb7d55f291f57f8c7384f3741396ec1a5df571b77'
AND (
token = 'jaY6LwV4mfsmroTdXjHqfKL1S2zw4+NUmsD3Yam/mgo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)