UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PJWg5zB45nV8f86jupOZJniX/FZ/tEUeGgPeijV2bgM=' 
WHERE 
  key_id = '9bc06031587ba71e8665efcbccc13a8a868eff8651ab83d7d1bdd95198268f10' 
  AND (
    token = 'PJWg5zB45nV8f86jupOZJniX/FZ/tEUeGgPeijV2bgM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00095