UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KKdFz+amOYtAwLr1FOdh/1v7ETvtApmxNe+xaHWwlHA=' 
WHERE 
  key_id = 'f5600838d04394ca2beceb8de450368e5ec6073d00d85914266a735073ece22b' 
  AND (
    token = 'KKdFz+amOYtAwLr1FOdh/1v7ETvtApmxNe+xaHWwlHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030