UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fzSRZlLBnNbj65OKPWaQPHx3suOkcmdx6qBwMWYj0FY=' 
WHERE 
  key_id = '4f7724a9bb94ff6e66c8fa80f6611fad786879b55318e142088cd72ada71005c' 
  AND (
    token = 'fzSRZlLBnNbj65OKPWaQPHx3suOkcmdx6qBwMWYj0FY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045