UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ooyuXbXMYLM/BkSsxsBrnZ5PHIf9LBHmb8EVs2rBQIU=' 
WHERE 
  key_id = '23a205a0860ea317bf65a7e821c296d456359fd7d25de017d06a722bc9dc536e' 
  AND (
    token = 'ooyuXbXMYLM/BkSsxsBrnZ5PHIf9LBHmb8EVs2rBQIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039