UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C+gglj/pAFZoTo0oLBL/O0wA3eLjU24gKM6O0Ben1G4='
WHERE
key_id = '1a1cf03ee19f81dc47596bf7b7ec2f01770febc2cecdcc13488780c2e301ec63'
AND (
token = 'C+gglj/pAFZoTo0oLBL/O0wA3eLjU24gKM6O0Ben1G4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)