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