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