UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qn4wwX5aqdGYvUw95+hvZpIClcidi+ONRDe2CxAAZBY='
WHERE
key_id = '49c1e15765fffbb0af04160db88e1443611a5ba1c390c0694acbc4c3338bf167'
AND (
token = 'qn4wwX5aqdGYvUw95+hvZpIClcidi+ONRDe2CxAAZBY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)