UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '17Gd0n2TDNbzfNSmzf09qBDKf+lnJEjrYBegAk43brE=' 
WHERE 
  key_id = '8e79d49b6444fdd21c446bece3a1b0e8ad8115df834b4c7a24d131ad3004e6ee' 
  AND (
    token = '17Gd0n2TDNbzfNSmzf09qBDKf+lnJEjrYBegAk43brE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036