UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hKGR2MO5FkT4E7uZtZgTh2Cl8ybaAILIlY8rY2B9Fo4=' 
WHERE 
  key_id = '31be02ef9f3cbe50a904b306cbce5e2e4eb032b2277f6968fdcfc81f65d693b9' 
  AND (
    token = 'hKGR2MO5FkT4E7uZtZgTh2Cl8ybaAILIlY8rY2B9Fo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050