UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AKO90vzBL+kQ7u1hyxsXWYCEo++fUhjWBs+FUCXseQE=' 
WHERE 
  key_id = 'fd52a9cf347608214f2155cc4501457505063a9c7d64f58297cd8979fc0a280a' 
  AND (
    token = 'AKO90vzBL+kQ7u1hyxsXWYCEo++fUhjWBs+FUCXseQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020