UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k1Pm3BLsl+3u//+0o6EUaBzrGCVN+10bObtnBJX7fzk=' 
WHERE 
  key_id = 'ae78e365d00ada74dee92ddb4ea0830d50312b26a9540b88b39e6fdd585f7438' 
  AND (
    token = 'k1Pm3BLsl+3u//+0o6EUaBzrGCVN+10bObtnBJX7fzk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049