UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lOyW4BHkYEwV72rY2m/xjQmx96TuSKx1yCrP+4zkCj4='
WHERE
key_id = 'd0afedcf69e6f4a31d86a0987c1a7ebf4fcd305d9e910df71dc15654655af553'
AND (
token = 'lOyW4BHkYEwV72rY2m/xjQmx96TuSKx1yCrP+4zkCj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)