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