UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mLsAD0BY44AM1uxokwKjq65hIrBXbOstZ8WyhefOgQ4=' 
WHERE 
  key_id = '3cc6b7a026b1a978829a4f7dafb45a2f31bbe1142c3ce13a7d64b0e55e67fb1d' 
  AND (
    token = 'mLsAD0BY44AM1uxokwKjq65hIrBXbOstZ8WyhefOgQ4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026