UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WIFNwVUitxxgc41EHPnToelA3qGa7r3MrXOlasctGB0=' 
WHERE 
  key_id = 'b887a49f92d1d6aa58ddc8b1fe63a2dc5f69fcdbf7d36be6991d2b30d53116a4' 
  AND (
    token = 'WIFNwVUitxxgc41EHPnToelA3qGa7r3MrXOlasctGB0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037