UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TdOoiDPiEPv9F8PNDVy9bHHkuR6JcNNs9/r3/US6CUo='
WHERE
key_id = '897d4db6a80e5ee8686e75c7827d79edbe7979a51af0419db9e7a562068a404d'
AND (
token = 'TdOoiDPiEPv9F8PNDVy9bHHkuR6JcNNs9/r3/US6CUo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)