UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x4MMdXtH/aMODcLBc/LiMFuLzqxygfTCiexxPCO/X9I='
WHERE
key_id = '9df24363f254fd07995e8ac0e468f9bea10ba7d6f59d2645965b271b94e602a9'
AND (
token = 'x4MMdXtH/aMODcLBc/LiMFuLzqxygfTCiexxPCO/X9I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)